import request from '@/utils/request'

// 添加
export function addServices(data) {
  return request({
    url: '/services/add',
    method: 'post',
    data: data
  })
}

// 编辑
export function editServices(data) {
  return request({
    url: '/services/edit',
    method: 'post',
    data: data
  })
}

// ID查询单个数据
export function getServices(id) {
  return request({
    url: '/services/info',
    method: 'post',
    params: { id }
  })
}

// 删除
export function delServices(id) {
  return request({
    url: '/services/delete',
    method: 'post',
    params: { id }
  })
}

// 批量删除
export function delListServices(idList) {
  return request({
    url: '/services/delete/list',
    method: 'post',
    data: idList
  })
}

// 查询分页数据
export function dataServices(query) {
  return request({
    url: '/services/data',
    method: 'post',
    params: query
  })
}

// 查询全部数据
export function allServices() {
  return request({
    url: '/services/all',
    method: 'post',
  })
}

// 条件查询列表数据
export function listServices(data) {
  return request({
    url: '/services/list',
    method: 'post',
    data: data
  })
}

// 根据字段、排序方式、limit条 查询列表数据
export function listLimitServices(field, sort, limit) {
  return request({
    url: '/services/list/limit',
    method: 'post',
    params: { field, sort, limit }
  })
}

// 根据字段查询列表数据
export function listFieldServices(field, value) {
  return request({
    url: '/services/list/field',
    method: 'post',
    params: { field, value }
  })
}

// 动态查询单个数据
export function dynamicGetServices(data) {
  return request({
    url: '/services/info/dynamic',
    method: 'post',
    data: data
  })
}

// 查看详情数据
export function detailsGetServices(id) {
  return request({
    url: '/services/details',
    method: 'post',
    params: { id }
  })
}

// 全部条数
export function countServices() {
  return request({
    url: '/services/count',
    method: 'post',
  })
}

// 条件查询条数
export function dynamicCountServices(data) {
  return request({
    url: '/services/count/dynamic',
    method: 'post',
    data: data
  })
}

export function statisticsServicesCategory() {
  return request({
    url: '/services/statistics/category',
    method: 'post',
  })
}
